from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models

class Organization(models.Model):
    name=models.CharField(max_length=50)
    introduction=models.TextField()
    createTime=models.DateField(auto_now=True)
    # rel=models.ManyToManyField(Person,null=True)
    def __unicode__(self):
        return self.name
class GradeClass(models.Model):
    gradename=models.CharField(max_length=50)
    classname=models.CharField(max_length=50)
    def __unicode__(self):
        return self.gradename+'-'+self.classname

class Team(models.Model):
    name=models.CharField(max_length=50)
    vocation=models.CharField(max_length=20)
    area=models.CharField(max_length=20)
    team_code=models.CharField(max_length=50,default="")
    # member_list=models.ManyToManyField(Person,null=True)
    def __unicode__(self):
        return self.name

class Person(models.Model):
    name=models.CharField(max_length=20)
    phone=models.CharField(max_length=20)
    email=models.EmailField(default="")
    wechat=models.CharField(max_length=20,default="")
    user=models.OneToOneField(User)
    grade_class=models.TextField(default="")
    is_super=models.BooleanField(default=False)
    # class_name=models.CharField(max_length=50,default="")
    rel=models.ManyToManyField(Organization,null=True)
    grade_class_list=models.ManyToManyField(GradeClass,null=True)
    friends=models.ManyToManyField('self',null=True)
    team_list=models.ManyToManyField(Team,null=True)
    def __unicode__(self):
        return self.name




